﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DieuTriNoiTru
{
    public partial class frmMain : Form
    {
        clsKetnoi kn = new clsKetnoi();
        public frmMain()
        {
            InitializeComponent();
        }

        private void tÙYCHỌNToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string str = "Select * From Taikhoan Where TenDangnhap = N'" + textBox1.Text.ToString() + "' and MatKhau = '" + textBox2.Text.ToString() + "'";
                DataTable tb = new DataTable();
                tb.Load(kn.ThucHienReader(str));
                if (tb.Rows.Count == 1)
                {
            
                    MessageBox.Show("Da ket noi CSDL !", "Chuc mung", MessageBoxButtons .OK, MessageBoxIcon .Error);
                }
                else
                {
                    MessageBox.Show("khong ket noi duoc CSDL !", "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("khong ket noi duoc CSDL !", "Thong bao", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
